﻿using System;
using Mbs;
using Mbs.Modularity;
using Mbs.ComponentModel.Container;
using Mbs.ComponentModel.Container.Loader;
using ElementMap.Module;
using Mbs.Windows.Elements;
using Mbs.Windows.Attributes;

[assembly: AddIn(
    Name = "${res:ElementMap}"
    , Author = "qswang"
    , Url = "http://netcasewqs.cnblogs.com"
    , Description = "${res:ElementMap}"
    , AddInActivator = typeof(ModuleStarter))]

//ToolBar 
[assembly: ToolStripDropDownButton(Path = "Shell/ToolBar/ElementMap"
    , Label = "${res:ElementMap}"
    , Command = CommandNames.ElementMap)]
[assembly: ToolStripMenuItem(Path = "Shell/ToolBar/ElementMap/ShowCustomer/"
    , Label = "${res:ElementMap.Show}"
    , Command = CommandNames.ShowCustomer
    , ToolTip = "Show Customer")]
[assembly: ToolStripMenuItem(Path = "Shell/ToolBar/ElementMap/DisableShowCustomer/"
    , Label = "${res:ElementMap.Disable}"
    , Command = CommandNames.DisableShowCustomer
    , ToolTip = "Disable Customer")]
[assembly: ToolStripMenuItem(Path = "Shell/ToolBar/ElementMap/EnableShowCustomer/"
    , Label = "${res:ElementMap.Enabled}"
    , Command = CommandNames.EnableShowCustomer)]
[assembly: ToolStripSeparator(Path = "Shell/ToolBar/ElementMap/Separator")]


//MainMenu
[assembly: ToolStripMenuItem(Path = "Shell/MainMenu/Module/ElementMap"
    , Label = "${res:ElementMap}"
    , Command = CommandNames.ElementMap)]
[assembly: ToolStripMenuItem(Path = "Shell/MainMenu/Module/ElementMap/ShowCustomer/"
    , Label = "${res:ElementMap.Show}"
    , Command = CommandNames.ShowCustomer
    , ToolTip = "Show Customer")]
[assembly: ToolStripMenuItem(Path = "Shell/MainMenu/Module/ElementMap/DisableShowCustomer/"
    , Label = "${res:ElementMap.Disable}"
    , Command = CommandNames.DisableShowCustomer
    , ToolTip = "Disable Customer")]
[assembly: ToolStripMenuItem(Path = "Shell/MainMenu/Module/ElementMap/EnableShowCustomer/"
    , Label = "${res:ElementMap.Enabled}"
    , Command = CommandNames.EnableShowCustomer)]
[assembly: ToolStripSeparator(Path = "Shell/MainMenu/Module/ElementMap/Separator")]



[assembly: View(Path = SmartPartNames.ElementMapView
    ,ViewType=typeof(ElementMapView)
    , Workspace = "MainWorkSpace")]

namespace ElementMap.Module
{
    public class ModuleStarter:ModuleActivator
    {
        public ModuleStarter()
        {
        }

        public override void Start()
        {
            base.Start();

            (Registry as IKernel).LoaderManager.Register(new AssemblyLoader(typeof(ModuleStarter).Assembly));
            CommandNames.DisableShowCustomer.Command().Enabled = false;
            Disposes.Add(CommandNames.ElementMap.Subscribe<EventArgs>((s, e) => Locator.Get<IElementMapPresenter>().ShowView()));
        }
    }
}
